package com.lhh.myspringboot.controller;


import com.lhh.myspringboot.bean.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

@RequestMapping("SwaggerController")
@RestController
@Api(tags = "SwaggerController 控制器")
public class SwaggerController {


    @GetMapping("hello")
    @ApiOperation("得到 hello")
    public String getHello(@ApiParam("名字") @RequestParam String name){

        return "hello ! " + name ;

    }

    @PostMapping("user")
    @ApiOperation("得到 密码为123456的User对象")
    public User getHello(@ApiParam("User实体类") @RequestBody User u){

        User user = new User();
        user.setUsername(u.getUsername());
        user.setPassword("123456");

        return user ;

    }
}
